import Vue from 'vue'
import Router from 'vue-router'
//页面组件
import HelloWorld from '@/components/HelloWorld'
import Login from '@/components/Login'
import UserInfo from '@/components/user/UserInfo'
import BaseInfo from '@/components/user/BaseInfo'
import GuarInfo from '@/components/user/GuarInfo'
import NonTaxInfo from '@/components/user/NonTaxINfo'

Vue.use(Router)

const router = new Router({
  routes: [
    {
      path: '/hello',
      name: 'HelloWorld',
      component: HelloWorld,
			meta:{
				auth:true
			}
    },
		{
			path:'/',
			name:'Login',
			component:Login,
			meta:{
				auth:false
			}
		},
		{
			path:'/info',
			name:"UserInfo",
			component:UserInfo,
			meta:{
				auth:true
			},
			children:[
				{
					path:"/info/baseInfo",
					name:"BaseInfo",
					component:BaseInfo,
					show:true
				},
				{
					path:"/info/guarInfo",
					name:"GuarInfo",
					component:GuarInfo,
					show:true
				},
				{
					path:"/info/NonTaxInfo",
					name:"NonTaxInfo",
					component:NonTaxInfo,
					show:true
				}
			]
		}
  ]
})

//路由拦截
// router.beforeEach((to, _, next) => {
// 	if (to.matched.some((m) => m.meta.auth)) {
// 		if (to.name == "") {
// 			next();
// 		} else {
// 			if ($store.state.isLogin == true) {
// 				next();
// 			} else {
// 				next("/");
// 			}
// 		}
// 	} else {
// 		next();
// 	}
// });
export default router;
